@extends('backend::common.common_right')
@section('content')
<div class="col-sm-12">
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>后台@if($paytype == 1)充值@else扣费@endif</h5>
            <div class="ibox-tools">
                <a class="close-link" href="javascript:history.go(-1);">
                    <i class="fa fa-times" ></i>
                </a>
            </div>
        </div>
        <div class="ibox-content">
            <form class="form-horizontal m-t" onsubmit="check()" action="{{url('backend/borderedit')}}" method="post" id="signupForm">
                {{ csrf_field() }}
                <input type="hidden" name="paytype" value="{{$paytype}}">
                <input type="hidden" name="admin_id" value="{{Auth::guard('admin')->user()->id}}">
                <div class="form-group{{ $errors->has('mobile') ? ' has-error' : '' }}">
                    <label class="col-sm-3 control-label">手机号：</label>
                    <div class="col-sm-8">
                        <input  value="" name="mobile" class="form-control" type="text" aria-required="true" aria-invalid="true" class="error">
                        @if ($errors->has('mobile'))
                            <span class="help-block">
                                <strong>{{ $errors->first('mobile') }}</strong>
                            </span>
                        @endif
                    </div>
                </div>
                <div class="form-group{{ $errors->has('coins') ? ' has-error' : '' }}">
                    <label class="col-sm-3 control-label">交易币数量：</label>
                    <div class="col-sm-8">
                        <input value="" name="coins" class="form-control" type="text" aria-required="true" aria-invalid="true" class="error">
                        @if ($errors->has('coins'))
                            <span class="help-block">
                                <strong>{{ $errors->first('coins') }}</strong>
                            </span>
                        @endif
                    </div>
                </div>
                @if($paytype == 1)
                    <div class="form-group">
                        <label class="col-sm-3 control-label">VIP：</label>
                        <div class="col-sm-9">
                            <label class="radio-inline">
                                <input type="radio"  value="1"  name="is_vip">是</label>
                            <label class="radio-inline">
                                <input type="radio" value="0" checked=""  name="is_vip">否</label>
                        </div>
                    </div>
                    <div class="form-group" id="viptime" style="display: none;">
                        <label class="col-sm-3 control-label">VIP充值期限：<br/></label>
                        <div class="col-sm-8">
                            <select class="form-control m-b" name="vip">
                                <option value="3">3个月</option>
                                <option value="12">12个月</option>
                            </select>
                        </div>
                    </div>
                @endif
                <div class="form-group">
                    <label class="col-sm-3 control-label">备注：</label>
                    <div class="col-sm-8">
                        <textarea name="note"  cols="32" rows="5"></textarea>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-8 col-sm-offset-3">
                        <button class="btn btn-primary" type="submit">提交</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script>
    $("input[name='is_vip']").change(function () {
        if($(this).val() == 1){
            $("#viptime").show();
        }else{
            $("#viptime").hide();
        }
    })
    var check = function () {
        if($("input[name='coins']").val() == ''){
            $("input[name='coins']").remove();
        }
        if($("textarea[name='note']").val() == ''){
            $("textarea[name='note']").remove();
        }
    }
</script>
@endsection